from django.shortcuts import render

# Create your views here.
from django.shortcuts import render
from django.http import JsonResponse
# Create your views here.
from .models import Project


def index(request):
    print(request.user)
    return JsonResponse({"name": "journal"})


def get_user_project_ids(request):
    # 获取当前用户所有项目ID
    user = request.user
    project_ids = Project.objects.filter(
        created_by=user).values_list('id', flat=True)
    return JsonResponse({'project_ids': list(project_ids)})
